#include<stdlib.h>

char *mergeAlternately(char *word1, char *word2)
{
    int len1 = strlen(word1), len2 = strlen(word2), i = 0, j = 0;
    char *word = (char *)malloc(sizeof(char) * (len1 + len2 + 1));
    while (i < len1 || i < len2)
    {
        i < len1 ? (word[j++] = word1[i]) : 0;
        i < len2 ? (word[j++] = word2[i]) : 0;
        i++;
    }
    word[j] = '\0';
    return word;
}